feat: add retentionPolicy in storage migration plan#2683
feat: add retentionPolicy in storage migration plan#2683duyanyan wants to merge 1 commit intoRedHatQE:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughTwo resource migration plan classes (MultiNamespaceVirtualMachineStorageMigrationPlan and VirtualMachineStorageMigrationPlan) now accept an optional Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ocp_resources/virtual_machine_storage_migration_plan.py (1)
20-49:⚠️ Potential issue | 🟠 MajorDirect edits were made in generated resource code; move this change to the generator.
These updates are inside the generated section. Please implement
retention_policysupport in the class-generator source/template and regenerate this resource file, rather than maintaining manual edits here.As per coding guidelines, code in
**/ocp_resources/**between generated markers must not be edited directly; update the class-generator instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ocp_resources/virtual_machine_storage_migration_plan.py` around lines 20 - 49, The retention_policy change was made directly in the generated resource; instead update the class-generator/template so this field is generated. Modify the generator to add a retention_policy: str | None parameter to the resource constructor (alongside virtual_machines), assign it to self.retention_policy, and ensure to_dict emits _spec["retentionPolicy"] when self.retention_policy is not None (same pattern used for virtual_machines and MissingRequiredArgumentError checks); then regenerate ocp_resources/virtual_machine_storage_migration_plan.py so the manual edits are removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@ocp_resources/virtual_machine_storage_migration_plan.py`:
- Around line 20-49: The retention_policy change was made directly in the
generated resource; instead update the class-generator/template so this field is
generated. Modify the generator to add a retention_policy: str | None parameter
to the resource constructor (alongside virtual_machines), assign it to
self.retention_policy, and ensure to_dict emits _spec["retentionPolicy"] when
self.retention_policy is not None (same pattern used for virtual_machines and
MissingRequiredArgumentError checks); then regenerate
ocp_resources/virtual_machine_storage_migration_plan.py so the manual edits are
removed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 55d6ea3f-6353-4115-b313-f000bb1dcb77
📒 Files selected for processing (2)
ocp_resources/multi_namespace_virtual_machine_storage_migration_plan.pyocp_resources/virtual_machine_storage_migration_plan.py
| Each namespace item can contain: | ||
| - name (str): Namespace name | ||
| - retentionPolicy (str, optional): Namespace-level retention policy (e.g., 'keepSource' or 'deleteSource') | ||
| - virtualMachines (list): VMs to migrate | ||
| retention_policy (str, optional): Spec-level retention policy for source volumes (e.g., 'keepSource' or 'deleteSource'). | ||
|
|
There was a problem hiding this comment.
did you generate the resource using class-generator?
There was a problem hiding this comment.
no, but I have updated the code with class-generator, please review again
| r""" | ||
| Args: | ||
| virtual_machines (list[Any]): The virtual machines to migrate. | ||
| retention_policy (str, optional): Spec-level retention policy for source volumes (e.g., 'keepSource' or 'deleteSource'). |
061a4b6 to
664affc
Compare
Short description:
Add retentionPolicy in storage migration plan resources
More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
Bug:
Summary by CodeRabbit